Current Location: Home> Function Categories> date_sunrise

date_sunrise

Returns the sunrise time for the given date and location
Name:date_sunrise
Category:Date and time
Programming Language:php
One-line Description:Returns the sunrise time of the specified date and location.

Definition and usage

date_sunrise() function returns the sunrise time of the specified date and place.

Tip: See the date_sunset() function to return the sunset time of the specified date and place.

Example

Return to Shanghai, China today's sunrise time:

 <?php
// Shanghai, China:
// Dimension: North latitude 31.22, longitude: West latitude 121.47
// Zen ~= 90, offset: +8 GMT

echo ( "Shanghai, China: Date: " . date ( "DM d Y" ) ) ;
echo ( "<br>Sunrise time:" ) ;
echo ( date_sunrise ( time ( ) , SUNFUNCS_RET_STRING , 31.22 , 121.47 , 90 , 8 ) ) ;
?>

Try it yourself

grammar

 date_sunrise ( timestamp , format , latitude , longitude , zenith , gmtoffset ) ;
parameter describe
timestamp Required. Specifies the date and time stamp to calculate the sunrise time.
format

Optional. Specifies how to return the result:

  • SUNFUNCS_RET_STRING (return the result as a string, for example 16:46) (default)
  • SUNFUNCS_RET_DOUBLE (return the result in a floating point number, for example 16.78243132)
  • SUNFUNCS_RET_TIMESTAMP (returns the result as an integer (timestamp), for example 1095034606)
latitude Optional. The latitude of the specified location. The default is North latitude. To specify a South Latitude, pass a negative value.
longitude Optional. The longitude of the specified location. By default, it refers to Eastern Longitude. If you need to specify the Western Bible, please pass a negative value.
zenith Optional. Default is date.sunrise_zenith.
gmtoffset Optional. Specifies the difference between GMT and local time, in hours.
Similar Functions
Popular Articles